#coding:utf-8


userlist=[]
# users["username"] = "zs"
# users["password"] = "123"
#userlist.append(users)
#print(userlist[0])

while  True:
    users = {}
    users["username"] = input("请输入username: ")
    users["password"] = input("请输入password: ")
    userlist.append(users)
    yn = input("是否退出（y/n）： ")
    if yn == "y":
        print(userlist)
        break

flag = False
count =1
while  count<=3:  #3次输入错误的机会
    username = input("用户名：")
    password = input("密  码：")

    for l in userlist:
        print(l)
        if username ==l["username"] and str(password) == l["password"] :
            print("登录成功！")
            flag =True
            break
    count+=1
    if flag ==True:
        break